pkgver=0.1
_desc="Tools and scripts for orange pi 5"

pkgname=orange-pi5-board-package
pkgrel=1
arch=('aarch64')
url="none"
license=('custom')
options=('!strip')
depends=('uboot-tools')
source=(
	"https://github.com/armbian/firmware/raw/master/mali_csffw.bin"
	"rk3588s-orangepi-5.dtb" "orange-pi5.start" "95-uboot.hook"
	"armtixEnv.txt" "boot.cmd" "uboot-update.sh"
)
install="${pkgname}.install"


package() {

  cd "${srcdir}"
  # copy or make boot files
  install -m644 -vDt "${pkgdir}/boot" "armtixEnv.txt"
  install -m644 -vDt "${pkgdir}/boot/dtbs/rockchip" "rk3588s-orangepi-5.dtb"
  ln -s 'vmlinuz-linux-rockchip-rk3588' "${pkgdir}/boot/Image"
  ln -s 'uInitrd-linux-rockchip-rk3588' "${pkgdir}/boot/uInitrd"
  ln -s 'dtbs' "${pkgdir}/boot/dtb"
  mkimage -C none -A arm -T script -d "${srcdir}/boot.cmd" "${pkgdir}/boot/boot.scr"

  # copy alpm hook
  install -m644 -vDt "${pkgdir}/usr/share/libalpm/hooks/" 95-uboot.hook
  install -m755 -vDt "${pkgdir}/usr/share/libalpm/scripts" uboot-update.sh

  # copy blob and config
  install -m755 -vDt "${pkgdir}/etc/local.d/" orange-pi5.start
  install -m644 -vDt "${pkgdir}/usr/lib/firmware" mali_csffw.bin
}

sha256sums=('9e9cede2cb8f45228216f39259552ac886950be9daf59e2591c73bde60010699'
            '65268cf5842b26f5116bd25311d87db0567c973c533af10e3289a38ee9ec8035'
            'ad8d744b25e4d46885f02e1529050c6330409230a1710d7cb03060c255aa9662'
            '71dc1fb7773c321b289486e26ecfddbc85b6fc2157bdb0e07dc889ff242ec77f'
            'ce5c5c2d80659ce5d64411e28d788b40f4a1e280df168813dadc6c42aa7dbb44'
            '7e01a2e669c2772fa9a982bb49b6f59c72f2d71b7f2b7323bbd0009ff113323a'
            '6bd3a742ffb85acb671f311a1eb6add964462341a96e692afdcf76993f2ae463')
